<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // // 8,  有一个从小到大排好序的数组。现输入一个数，要求按原来的规律将它插入数组中,      
        // 如: [2,3,4,56,67,98]    //63, 100
    var num8=parseInt(prompt("请输入数字"));
    var a8=[2,3,4,56,67,98];
    for(var i=0;i<a8.length;i++){
        if(num8<=a8[i]){
            a8.splice(i,0,num8);
            break;
        }
        if(num8>a8[a8.length-1]){
            a8.push(num8);
        }
    }
    console.log(a8);
    </script>
</body>
</html>